import 'package:aichat_flutter_wallet/module/module_browser/widget/browser_search.dart';
import 'package:aichat_flutter_wallet/module/module_browser/widget/browser_webview.dart';
import 'package:flutter/material.dart';

class BrowserPage extends StatefulWidget {
  BrowserPage({super.key, this.url = 'https://baidu.com', this.userScripts,this.onClose});
  String? url;
  List<String>? userScripts;
  Function? onClose;

  @override
  State<BrowserPage> createState() => _BrowserPageState();
}

class _BrowserPageState extends State<BrowserPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Column(
          children: [
            BrowserSearchWidget(
              url: widget.url!,
                onClose:widget.onClose
            ),
            Expanded(
                child:
                BrowserWebViewWidget(
                    url: widget.url!, userScripts: widget.userScripts!)),
          ],
        ),
      ),
    );
  }
}
